home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / TEECHART / Src Code / EDITCHAR.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-10-24  |  3.6 KB  |  149 lines

  1. {****************************************}
  2. {     TeeChart Pro Charting Library      }
  3. {  For Delphi 1,2,3,4 & C++ Builder 1&3  }
  4. { Copyright (c) 1995-98 by David Berneda }
  5. {         All Rights Reserved            }
  6. {****************************************}
  7. {$I teedefs.inc}
  8. unit EditChar;
  9.  
  10. interface
  11.  
  12. Uses Classes,Graphics,Forms,TeEngine,Chart,
  13.      {$IFDEF D1}
  14.      iEdit16
  15.      {$ELSE}
  16.      iEditCha
  17.      {$ENDIF}
  18.      ;
  19.  
  20. Function EditFont(AOwner:TComponent; AFont:TFont):TFont;
  21.  
  22. Procedure EditChartLegend(Form:TForm; AChart:TCustomChart);
  23. Procedure EditSeries(Form:TForm; ASeries:TChartSeries);
  24. Procedure EditChart(Form:TForm; AChart:TCustomChart);
  25. Procedure EditChartAxis(Form:TForm; Axis:TCustomChartAxis);
  26. Procedure EditChartWall(Form:TForm; AWall:TChartWall);
  27. Procedure EditChartTitle(Form:TForm; ATitle:TChartTitle);
  28. Procedure EditChartPage(Form:TForm; AChart:TCustomChart; PageIndex:Longint);
  29. Procedure EditChartPart(Form:TForm; AChart:TCustomChart; Const Part:TChartClickedPart);
  30.  
  31. {$IFDEF D3}
  32. Procedure EditDSSChart(AOwner:TComponent; ADSSChart:TCustomChart);
  33. {$ENDIF}
  34.  
  35. implementation
  36.  
  37. Uses TeeProcs,TeeConst,CustEdit,AreaEdit,BarEdit,PieEdit,FLineEdi,ShapeEdi,
  38.      GanttEdi,ArrowEdi,BubbleCh,BrushDlg,StdCtrls;
  39.  
  40. Function EditFont(AOwner:TComponent; AFont:TFont):TFont;
  41. Begin
  42.   result:=InternalEditFont(AOwner,AFont);
  43. end;
  44.  
  45. Function GetChartEditClass(AChart:TCustomAxisPanel):TChartEditForm;
  46. begin
  47.   result:=TChartEditForm.Create(Application);
  48.   result.TheChart:=TCustomChart(AChart);
  49.   {$IFDEF TEEHELPEDITOR}
  50.   result.CheckHelpFile;
  51.   {$ENDIF}
  52. end;
  53.  
  54. Procedure EditSeries(Form:TForm; ASeries:TChartSeries);
  55. begin
  56.   With GetChartEditClass(ASeries.ParentChart) do
  57.   try
  58.     TheEditSeries:=ASeries;
  59.     ShowModal;
  60.   finally
  61.     Free;
  62.   end;
  63. end;
  64.  
  65. Procedure EditChartPage(Form:TForm; AChart:TCustomChart; PageIndex:Longint);
  66. begin
  67.   With GetChartEditClass(AChart) do
  68.   try
  69.     TheActivePageIndex:=PageIndex;
  70.     ShowModal;
  71.   finally
  72.     Free;
  73.   end;
  74. end;
  75.  
  76. Procedure EditChartTitle(Form:TForm; ATitle:TChartTitle);
  77. Begin
  78.   With GetChartEditClass(TCustomChart(ATitle.ParentChart)) do
  79.   try
  80.     TheTitle:=ATitle;
  81.     TheActivePageIndex:=teeEditTitlePage;
  82.     ShowModal;
  83.   finally
  84.     Free;
  85.   end;
  86. end;
  87.  
  88. Procedure EditChartWall(Form:TForm; AWall:TChartWall);
  89. Begin
  90.   With GetChartEditClass(AWall.ParentChart) do
  91.   try
  92.     TheWall:=AWall;
  93.     TheActivePageIndex:=teeEditWallsPage;
  94.     ShowModal;
  95.   finally
  96.     Free;
  97.   end;
  98. end;
  99.  
  100. Procedure EditChartAxis(Form:TForm; Axis:TCustomChartAxis);
  101. Begin
  102.   With GetChartEditClass(Axis.ParentChart) do
  103.   try
  104.     TheAxis:=Axis;
  105.     TheActivePageIndex:=teeEditAxisPage;
  106.     ShowModal;
  107.   finally
  108.     Free;
  109.   end;
  110. end;
  111.  
  112. {$IFDEF D3}
  113. Procedure EditDSSChart(AOwner:TComponent; ADSSChart:TCustomChart);
  114. begin
  115.   With GetChartEditClass(ADSSChart) do
  116.   try
  117.     IsDssGraph:=True;
  118.     ShowModal;
  119.   finally
  120.     Free;
  121.   end;
  122. end;
  123. {$ENDIF}
  124.  
  125. Procedure EditChart(Form:TForm; AChart:TCustomChart);
  126. Begin
  127.   EditChartPage(Form,AChart,teeEditMainPage);
  128. end;
  129.  
  130. Procedure EditChartLegend(Form:TForm; AChart:TCustomChart);
  131. begin
  132.   EditChartPage(Form,AChart,teeEditLegendPage);
  133. end;
  134.  
  135. Procedure EditChartPart(Form:TForm; AChart:TCustomChart; Const Part:TChartClickedPart);
  136. begin
  137.   case Part.Part of
  138.     cpLegend   : EditChartLegend(Form,AChart);
  139.     cpAxis     : EditChartAxis(Form,Part.AAxis);
  140.     cpSeries   : EditSeries(Form,Part.ASeries);
  141.     cpTitle    : EditChartTitle(Form,AChart.Title);
  142.     cpFoot     : EditChartTitle(Form,AChart.Foot);
  143.   else
  144.     EditChart(Form,AChart);
  145.   end;
  146. end;
  147.  
  148. end.
  149.